#ifndef _SCHEDULER_LOG_H
#define _SCHEDULER_LOG_H

#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <map>
#include <malloc_align.h>
#include <csp_shared_types.h>
#include <ProcessComposition.h>

#define MAX_SCH_LOG_SIZE 200000


using namespace std;

typedef struct sched_log_item{
	char size;
	int pid;
	char slot;
	int pos;
	bool decrement;
} sched_log_item_t;


class SchedulerLog
{
	public:
		~SchedulerLog();
		static SchedulerLog* Instance();
		void Increment(ProcessComposition* p, int pos);
		void Decrement(ProcessComposition* p, int pos);
		void Print();
	protected:
		SchedulerLog();
		SchedulerLog(const SchedulerLog&);
		SchedulerLog& operator= (const SchedulerLog&);
	private:
		static SchedulerLog* pinstance;
		sched_log_item_t *log;
		pthread_mutex_t chan_log_lock;
		int i;
};

#endif
